package com.lcxw.hxzbapi.service;

import com.lcxw.hxzbapi.dao.mapper.ProportionMapper;
import com.lcxw.hxzbapi.entity.pojo.Proportion;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;

@Component
public class ProportionService {

    @Resource
    ProportionMapper proportionMapper;

    public Proportion getProp() {
        return proportionMapper.selectById(1);
    }

    public Proportion getPropForAdmin() {
        Proportion proportion = proportionMapper.selectById(1);
        Double ordinaryProp = proportion.getOrdinaryProp() * 100;
        Double unionProp = proportion.getUnionProp() * 100;
        Double ordinaryTax = proportion.getOrdinaryTax() * 100;
        proportion.setOrdinaryProp(ordinaryProp);
        proportion.setUnionProp(unionProp);
        proportion.setOrdinaryTax(ordinaryTax);
        return proportion;
    }

    public int updateProportion(Proportion proportion) {
        return proportionMapper.updateById(proportion);
    }


}
